UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'stMQGLNdgNT1np+FrguPc1dIGkEKwjedo3qwyjtgOIY=' 
WHERE 
  key_id = '84faaa4942624346140e9150bfb46b75d992680cc8367cbc581f232f637de728' 
  AND (
    token = 'stMQGLNdgNT1np+FrguPc1dIGkEKwjedo3qwyjtgOIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040