UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wXpFE6eX8DVOQd1sWiL8fyNRXDDcTppLlmWZzg/Nq3o=' 
WHERE 
  key_id = '1c1c34ec5070034babf0d79be487e44f17302772489bb45164705febfc064d3f' 
  AND (
    token = 'wXpFE6eX8DVOQd1sWiL8fyNRXDDcTppLlmWZzg/Nq3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025