UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ym0fCIFmfwFfYxieKc6TcKC1A7hNVnVAnytL037Pj2U=' 
WHERE 
  key_id = '915fff21c93ddb800496867a575faa6138079b2c4b1fa94e5cfcf6372286f61b' 
  AND (
    token = 'Ym0fCIFmfwFfYxieKc6TcKC1A7hNVnVAnytL037Pj2U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034