UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UMg5tUR8kCmLiKX9vZ8C8x/OHq4SnrGNuwpNkuArgqs=' 
WHERE 
  key_id = '4f158084cb759d11f84d2c951f5c851b037691e0997170ab5731ca82c7edc111' 
  AND (
    token = 'UMg5tUR8kCmLiKX9vZ8C8x/OHq4SnrGNuwpNkuArgqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035