UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gwm/QGsFhT0L1X6zkzAB17YT5jEqHefurnRDRyfB5ww=' 
WHERE 
  key_id = '7d0e4b1cc663ec66d609400338773948a7c080a8f3131b71e934251e53c52e3f' 
  AND (
    token = 'Gwm/QGsFhT0L1X6zkzAB17YT5jEqHefurnRDRyfB5ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037