UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0zV9015L0v5VMW0SyaukE1Q/6+1kED8OEEzWOoqhuqU=' 
WHERE 
  key_id = '4ce15c2df159fd3cd758aec5813d66b1998facc7688d4010d094288d6aa191fe' 
  AND (
    token = '0zV9015L0v5VMW0SyaukE1Q/6+1kED8OEEzWOoqhuqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030