UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IjGI4wT0OkWUMDdX9GgRlwLw+MzkscgmqeinXzDbPYo=' 
WHERE 
  key_id = '101058b9ff39ee0a0de21fcf10f882483526686a7afa6b71490b694d5f65c8e9' 
  AND (
    token = 'IjGI4wT0OkWUMDdX9GgRlwLw+MzkscgmqeinXzDbPYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043