UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HQk65VvWZC/cgIz1aompBkvST0KUJo7kbVoywPMoAY4=' 
WHERE 
  key_id = '334238b64ea9ec63230d4e2fefcaa32259fe30d8741a3051136f552f78b31a8e' 
  AND (
    token = 'HQk65VvWZC/cgIz1aompBkvST0KUJo7kbVoywPMoAY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051