UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eusWiRUuGOgF/I8gS0wuT0fd6utcd5u4zB+3UlShDkY=' 
WHERE 
  key_id = 'b718df8312f182d4e932b6af172f39f7884b6a360331cc65e68122f2bc79d9e6' 
  AND (
    token = 'eusWiRUuGOgF/I8gS0wuT0fd6utcd5u4zB+3UlShDkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028