UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YhWpX9z616SV93hdiDqorh/3vmsrM/mCxGXhgQycsP8=' 
WHERE 
  key_id = '992a13dcae14c9c8f681582bc8b9d1ab35f40ca671309f3ad85d9ac01faebfd3' 
  AND (
    token = 'YhWpX9z616SV93hdiDqorh/3vmsrM/mCxGXhgQycsP8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040