UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LW+dHiGlNmeYAqKhjG+nVBiUoKNHRsy5NQ+rnj1UIUM=' 
WHERE 
  key_id = '161500bffe03d46dced3f423ea40c171d060c5bfc6e8d1ddf3871a30e56f84d0' 
  AND (
    token = 'LW+dHiGlNmeYAqKhjG+nVBiUoKNHRsy5NQ+rnj1UIUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041