UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BNIlA1dqM3LHLxzY6rmOZ2pO5uHeZY/w5QHAo4RQWlE=' 
WHERE 
  key_id = '8e050afa5beaa3f13ebaf4d105fbc004ca617de2c98748f734a4a15587651add' 
  AND (
    token = 'BNIlA1dqM3LHLxzY6rmOZ2pO5uHeZY/w5QHAo4RQWlE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040