UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XUzsvRLl0AirhhOlXoMPWQvtvYcTzwrUsDI+46pfR9k=' 
WHERE 
  key_id = 'dd6281d7afbcaa8c47511de9f1247dcb3a468d7e396eb22c7e7b43b502001198' 
  AND (
    token = 'XUzsvRLl0AirhhOlXoMPWQvtvYcTzwrUsDI+46pfR9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028