UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WX4beGs+AnwTTXTC+EgNFC839v4oQC5Pzj7f+QSmtbo=' 
WHERE 
  key_id = '05f509df4bb4698c5a0789373d076e2e8d1806dbdc75152a2a0f4bbaa7a9e7a8' 
  AND (
    token = 'WX4beGs+AnwTTXTC+EgNFC839v4oQC5Pzj7f+QSmtbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015