UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f3TZNzC/0ljv8xiqt8hxJK9xC10hNfLIabK6Sz+5uq0=' 
WHERE 
  key_id = '71acefcf2b4e11a3d81b32b03c987c5d3a5fd99ee7664974fe43b2db9fee916a' 
  AND (
    token = 'f3TZNzC/0ljv8xiqt8hxJK9xC10hNfLIabK6Sz+5uq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034