UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WNosAKo0vzuRIHhxnuHTFmk8bQ04JiuZ8z7rFNFN3AQ=' 
WHERE 
  key_id = '2c115b99bad79f551a06dc562cac533425e2f95044cbc665ab717512eed39635' 
  AND (
    token = 'WNosAKo0vzuRIHhxnuHTFmk8bQ04JiuZ8z7rFNFN3AQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026