UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BjHQEFnuJ+z/hUTw41d/u/TjnW4Voa7t/vX3ArOrnzI=' 
WHERE 
  key_id = 'c377433e885295467b146aed1c718bc7cd2b1199f342b588aab8f918a26e91cd' 
  AND (
    token = 'BjHQEFnuJ+z/hUTw41d/u/TjnW4Voa7t/vX3ArOrnzI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027