UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yH0xMscfJoj/f3Oysjp4pxTJzeUOSiDW2xaW9wCBIwY=' 
WHERE 
  key_id = '8840c9a19cfa0deda6174327d6e97be9d7d83d2d34d7f044dc87cbc9312f3dd5' 
  AND (
    token = 'yH0xMscfJoj/f3Oysjp4pxTJzeUOSiDW2xaW9wCBIwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047