UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2tZ3yS6DZ509Mq3zduX45achrNKhKfZwRyj5pLMjC8o=' 
WHERE 
  key_id = '87a76df5b21387caf0540f63e8230a70b73efa98a0ec17767db8f25f85447389' 
  AND (
    token = '2tZ3yS6DZ509Mq3zduX45achrNKhKfZwRyj5pLMjC8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026