UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGaImuNQoYWu8QL3FvzmKvA+nkqeSBtSaBLdG2nQiyk=' 
WHERE 
  key_id = 'b1e49f635ce8ac2aa58a974b3ff55d5e05970650f478e05bdecad3d4a541a13b' 
  AND (
    token = 'pGaImuNQoYWu8QL3FvzmKvA+nkqeSBtSaBLdG2nQiyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017