UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hOAaJktGiVnccn9reoMxLNdcZIhvWUedIZNOahVi5H4=' 
WHERE 
  key_id = '243fddd21a955e39a634d72569dc0b1f5abf551173a93c2e105801fd7c34e351' 
  AND (
    token = 'hOAaJktGiVnccn9reoMxLNdcZIhvWUedIZNOahVi5H4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040