UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'myMeV5xq4YRUkUj5hV9nGY2Y3VRLz5D2RBFVYj/t+Q8=' 
WHERE 
  key_id = '631ab1294330b2747077309cdd715b8cf414ab96cc46d71dfe9f372279f8cdb7' 
  AND (
    token = 'myMeV5xq4YRUkUj5hV9nGY2Y3VRLz5D2RBFVYj/t+Q8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023