UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aTCzROGc4dFo0WxroUdesLjiA8rtLZNOC0JgJ8jxfbk=' 
WHERE 
  key_id = '83a951a46cbbbe95eecc6e1c5703a43dedd5a4cf694aca59e65be3bcd7ce54bf' 
  AND (
    token = 'aTCzROGc4dFo0WxroUdesLjiA8rtLZNOC0JgJ8jxfbk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035