UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'skoIKLIz3msteqMccyzL04Jj4DcAss6P7dqh7+73P4M=' 
WHERE 
  key_id = 'dead0d4f446184cd5b21f5ca9b59f4411a7816038b40af0dbb874f1c453048c3' 
  AND (
    token = 'skoIKLIz3msteqMccyzL04Jj4DcAss6P7dqh7+73P4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029