UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1vTLBBGR6gfjAcA9nOgpNoQ5UvIRsTTKeSsWlphwJU=' 
WHERE 
  key_id = 'a697939166ec200e0bddbaf87330e3ee26d32a00922f2f9c2ce3e603f96c7051' 
  AND (
    token = 'K1vTLBBGR6gfjAcA9nOgpNoQ5UvIRsTTKeSsWlphwJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041