UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HT7EDGATgtDQWX74YFr2b02/iimyY09VLMEKRpWKeAY=' 
WHERE 
  key_id = 'fce523620bcc07e1fe6daefa7defc414b48a3c0a345214584e7321140fbdad5d' 
  AND (
    token = 'HT7EDGATgtDQWX74YFr2b02/iimyY09VLMEKRpWKeAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028