UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1eqGQVpgd1sAur4cEEpQQD6h329VDToxDlkX82X7/qs=' 
WHERE 
  key_id = '4d6917795a873acadcc1e2cdfee2b295429c6363ec8e763e153011fdcdb0b6de' 
  AND (
    token = '1eqGQVpgd1sAur4cEEpQQD6h329VDToxDlkX82X7/qs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037