UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vfd+pkAytFazLQyG4ICmMm+qYKqn7inZjKoKmVbMsdw=' 
WHERE 
  key_id = '59c64d39a2e5afc3471af2ae082c251553666db04373c3b0757c815385c7eeaa' 
  AND (
    token = 'vfd+pkAytFazLQyG4ICmMm+qYKqn7inZjKoKmVbMsdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032