UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BEVx3zrO4sqouwGCoeA3D4o9U1y7gfeDobjYYoFat7A=' 
WHERE 
  key_id = '9376c6be15f5ba8335f160e3f801fc8294ed004025bb2a8e28607827da103e32' 
  AND (
    token = 'BEVx3zrO4sqouwGCoeA3D4o9U1y7gfeDobjYYoFat7A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041