UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AS56ErrPnQ7qTvxwzH5wAckovabqvlqamMr2A44HsKI=' 
WHERE 
  key_id = '9b7be9e362f0c6a9ad8649339f72edde5a52ac4a4a91e4eb555abf6863437ec4' 
  AND (
    token = 'AS56ErrPnQ7qTvxwzH5wAckovabqvlqamMr2A44HsKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030