UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qfl8iY9TzBTTAGMmsJVv4j9UIgKrs8haBcFtAQS6mnE=' 
WHERE 
  key_id = '217d7b9e88b68630d8db93c43f0c5f44137e6c8c5b69020c354cc792753add8d' 
  AND (
    token = 'qfl8iY9TzBTTAGMmsJVv4j9UIgKrs8haBcFtAQS6mnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024