UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lpS8rvFLzU5P+IFQpwVtHqw+HudTIeklKzA0XwqDaTw=' 
WHERE 
  key_id = '8811ba6bea5e5d7fe634527048d1d3d809862dc016facaede390246922f7baae' 
  AND (
    token = 'lpS8rvFLzU5P+IFQpwVtHqw+HudTIeklKzA0XwqDaTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024