UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZiCZl9mZ/TP58ouuz124frtLeZG3vjTc2u52ah8J9V8=' 
WHERE 
  key_id = '899d9a338fbbe6fa9a210cdf7b9f8be505dfc0c37db71616d14ebcaf95283b2a' 
  AND (
    token = 'ZiCZl9mZ/TP58ouuz124frtLeZG3vjTc2u52ah8J9V8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032