UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g23jdRFs5XZeeQEqTfa/g3adek+zPq6J3g7RMOng8XA=' 
WHERE 
  key_id = '17eef5267acf764ff4279e485c44aee698cec70d3fa5053340b14719d590d471' 
  AND (
    token = 'g23jdRFs5XZeeQEqTfa/g3adek+zPq6J3g7RMOng8XA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022