UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TY/JT+Sl2v2dUTr3Uhpwd0It1OmovSjNEbwcRkHbhgQ=' 
WHERE 
  key_id = '89371bdccde64e7a5a972440864127740d8eddac2af33b0b17b4f855b1614fa7' 
  AND (
    token = 'TY/JT+Sl2v2dUTr3Uhpwd0It1OmovSjNEbwcRkHbhgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050