UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g0xGKGWYVmMScL6U285wiee2VXMb7YvGzMj+ZR5Sqjs=' 
WHERE 
  key_id = '2d657517a1802b2ab13d18730c6df4268bee8370ea6e1bd241c7997786a27150' 
  AND (
    token = 'g0xGKGWYVmMScL6U285wiee2VXMb7YvGzMj+ZR5Sqjs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021