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

Query time 0.00024