UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y+IFGyltnGO7I0cVMqLuQFOxG9/xZdKbubwAyhnY1OQ=' 
WHERE 
  key_id = '9a666c784b651b361c1db4b3649fa9f92515552f2299df115329dd9f21a7045e' 
  AND (
    token = 'Y+IFGyltnGO7I0cVMqLuQFOxG9/xZdKbubwAyhnY1OQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032