UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cIYar/W3t+JsiIzUHtRCFT5pb8UlJR95hMZtM4U93nc=' 
WHERE 
  key_id = 'cad9dbe79baed854cded08b9abdf3caef118372b33ea2a91a8db73489188e096' 
  AND (
    token = 'cIYar/W3t+JsiIzUHtRCFT5pb8UlJR95hMZtM4U93nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016