UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OZMyr8VGivVAO7Kz5trFHVnahP1NXUoB6RGr11TN1nE=' 
WHERE 
  key_id = '1b9a4d7d6389db86f494a19c70e576c7bb5ffb9a1ab3da4a672b195b58b13484' 
  AND (
    token = 'OZMyr8VGivVAO7Kz5trFHVnahP1NXUoB6RGr11TN1nE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046